<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>test</title>
<%@ include file="/common/commonLib.jsp"%>
</head>
<body>
<center>课程相关测试<br>
<button id="courseList">课程list</button><br>
<button id="courseView">课程view</button><br>
<input type="text" name="code"><button id="courseDetail">课程详情</button><br>
</center><br>
<hr><br>
<center>
助教相关测试<br>
<input type="text" name="search"><button id="assistantTest">助教相关测试</button><br>
<input type="text" name="courseId"><input type="text" name="assistantId"><button id="addAC">添加助教到课程</button>
<br>
<input type="text" name="getAssistantId"><button id="aclist">助教负责课程</button><br>
<br>
<input type="text" name="getCourseId"><button id="calist">课程包含助教</button><br>
<br>
<input type="text" name="getAssistantsId"><button id="acslist">助教负责课程</button><br>

</center>
<center>
班级相关测试<br>
<button id="classList">班级列表</button>
</center>


<hr>

<center>
<button id="userDetail">我的信息</button>
</center>
</body>

<script>

$(document).ready(function(){
	 $("#courseList").on("click",courseList);  
	 $("#courseView").on("click",courseView); 
	 $("#courseDetail").on("click",courseDetail); 
	 $("#assistantTest").on("click",testAssistant); 
	 $("#addAC").on("click",addAC); 
	 $("#aclist").on("click",aclist);
	 $("#calist").on("click",calist);
	 $("#acslist").on("click",acslist);
	 $("#classList").on("click",classList);
	 $("#userDetail").on("click",userDetail);
})

var courseList=function(){
	var json={
			search:{
				tid:1001
			}
	}
	 $.get(CONTEXT_PATH+"course/ajaxListData", {
			data : JSON.stringify(json)
		}, function(json) {
			alert(JSON.stringify(json));
		}); 
}
var courseView= function (){
	var json={	
		tid:1001
	}
	 $.get(CONTEXT_PATH+"course/ajaxListView", {
			data : JSON.stringify(json)
		}, function(json) {
			alert(JSON.stringify(json));
		}); 
}

var courseDetail = function(){
	var id=$("input[name='code']").val();
	$.get(CONTEXT_PATH+"course/ajaxDetail/"+id, function(json) {
		alert(JSON.stringify(json));
	});
}

var testAssistant = function (){
	var search=$("input[name='search']").val();
	var json={	
			keywords:search
		}
		 $.get(CONTEXT_PATH+"assistant/ajaxListData", {
				data : JSON.stringify(json)
			}, function(json) {
				alert(JSON.stringify(json));
			}); 
}
var addAC = function (){
	var courseId=$("input[name='courseId']").val();
	var assignmentId=$("input[name='assistantId']").val();
	
	var json={	
			courseId:courseId,
			assistantId:assignmentId
		}
		 $.Post(CONTEXT_PATH+"accontrol/ajaxCreate", {
				data : JSON.stringify(json)
			}, function(json) {
				alert(JSON.stringify(json));
			}); 
}
var aclist = function (){
	var id=$("input[name='getAssistantId']").val();
		 $.get(CONTEXT_PATH+"accontrol/ajaxListCourse?id="+id, function(json) {
				alert(JSON.stringify(json));
			}); 
}
var calist = function (){
	var id=$("input[name='getCourseId']").val();
		 $.get(CONTEXT_PATH+"accontrol/ajaxListAssistant?id="+id, function(json) {
				alert(JSON.stringify(json));
			}); 
}
var acslist = function (){
	var id=$("input[name='getAssistantsId']").val();
		 $.get(CONTEXT_PATH+"accontrol/ajaxListCourseView?id="+id, function(json) {
				alert(JSON.stringify(json));
			}); 
}
var classList = function (){
	var json={	
			courseId:1
		};
		 $.get(CONTEXT_PATH+"class/ajaxListData", {
				data : JSON.stringify(json)
			}, function(json) {
				alert(JSON.stringify(json));
			}); 
}

var userDetail=function (){
	$.get(CONTEXT_PATH+"teacher/getDetail?id=1001", function(json) {
		alert(JSON.stringify(json));
	});
}

var updateInform=function(){
	var json={	
			courseId:1
		};
	$.Post(CONTEXT_PATH+"accontrol/ajaxCreate", {
		data : JSON.stringify(json)
	}, function(json) {
		alert(JSON.stringify(json));
	});
}
</script>
</html>